package com.Luooh.utils;

import com.google.gson.Gson;

public class JsonUtils {

    public static <T> String toJsonString(T o) {
	String json = null;
	if (o != null) {
	    Gson gson = new Gson();
	    json = gson.toJson(o);
	}
	return json;
    }

    public static <T> Object fromJsonToObject(String json, Class<T> t) {
	if (json != null) {
	    Gson gson = new Gson();
	    return gson.fromJson(json, t);
	}
	return null;
    }
}
